#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
#define rep(i, a, b) for (int i = (a); i <= (b); i++)
#define per(i, a, b) for (int i = (a); i >= (b); i--)
#define endl '\n'
const int N = 2e5 + 5;

ll n, m;
ll p[N];

bool check(ll mx) {
  ll money = m;
  rep(i, 1, n) {
    ll k = (mx + p[i]) / (2ll * p[i]);
    __int128_t now = (__int128_t)k * k * p[i];
    if (now > money) return false;
    money -= now;
  }
  return true;
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n >> m;
  rep(i, 1, n) cin >> p[i];
  ll l = 1, r = m;
  while (l <= r) {
    ll mid = (l + r) >> 1;
    if (check(mid))
      l = mid + 1;
    else
      r = mid - 1;
  }
  ll mx = r;
  ll sum = 0;
  rep(i, 1, n) {
    ll k = (mx + p[i]) / (2ll * p[i]);
    sum += k;
    m -= k * k * p[i];
  }
  sum += m / (mx + 1);
  cout << sum;
  return 0;
}